<template>
	<view class="">
		<view class="paper-public-info">
			<view class="base-info">
				<view class="cover"><img :src='inform.avatar' ></view>
				<view class="info">
					<view class="title text-ellipsis">{{ inform.nickname}}</view>
				</view>
			</view>

			<view class="result-info">
				<view class="score">
					<view class="title">考试成绩</view>
					<view class="value">{{inform.score}}</view>
				</view>
				<view class="total-time">
					<view class="title">答题时间</view>
					<view class="value">
						<!-- <span>00</span>:<span>00</span>:<span>05</span> -->
						{{inform.update_time}}

					</view>
				</view>
			</view>
		</view>
		<view class="paper-section">
			<view class="data-block">
				<view class="item total">总分：{{inform.total}} <span>分</span></view>
				<view class="item pass">及格：{{inform.pass}} <span>分</span></view>
				<view class="item exam-time">作答时间：{{inform.exam_time}} <span>分钟</span></view>
			</view>


			<view class="data-block">
				<view class="item type-1-count"><span>（单选题）</span><span>共 {{inform.type_1_count}} 道</span><span
						style="color: red;">共 {{inform.total_setting.type_1|| 0}}
						分</span><span>每题 {{inform.total_setting.type_1 / inform.type_1_count ||0}} 分</span></view>

				<view class="item type-1-count"><span>（多选题）</span><span>共 {{inform.type_2_count}} 道</span><span
						style="color: red;">共 {{inform.total_setting.type_2|| 0}}
						分</span><span>每题 {{inform.total_setting.type_2 / inform.type_2_count}} 分</span></view>
				<view class="item type-1-count"><span>（判断题）</span><span>共 {{inform.type_3_count ||0}} 道</span><span
						style="color: red;">共 {{inform.total_setting.type_3|| 0}}
						分</span><span>每题 {{inform.total_setting.type_3 / inform.type_3_count ||0}} 分</span></view>
				<view class="item type-1-count"><span>（填空题）</span><span>共 {{inform.type_4_count}} 道</span><span
						style="color: red;">共 {{inform.total_setting.type_4 || 0}}
						分</span><span>每题 {{ inform.total_setting.type_4 / inform.type_4_count ||0}} 分</span></view>
			</view>

			<view class="data-block">
				<view class="item total">共计：{{num()}} <span>道</span></view>

			</view>
		</view>
	</view>
</template>

<script>
	import {
		api_getexam_result
	} from '@/api/examcontent.js'
	export default {
		data() {
			return {
				checked: [],
				list: [],
				options: {},
				type: {
					1: '单选题',
					2: '多选题',
					3: '判断题',
					4: '填空题'
				},
				inform: {}

			}
		},

		onLoad(options) {
			this.options = options;
			this.query();
		},
		mounted() {

		},
		methods: {
			async query() {
				let res = await api_getexam_result(this.options);
				if (res.code === 1) {
					this.inform = res.data.data;
				} else {
					uni.showToast({
						title: result.msg,
						icon: 'error'
					});
				}
			},

			num() {
				let app = this;
				let {
					type_1_count,
					type_2_count,
					type_3_count,
					type_4_count
				} = app.inform;
				return type_1_count + type_2_count + type_3_count + type_4_count;
			}










		}
	}
</script>


<style scoped lang="scss">
	.paper-public-info {
		.base-info {
			width: 180rpx;
			margin: 30rpx auto;
			text-align: center;
		}

		.result-info {
			text-align: center;
			padding: 10rpx;
			margin-bottom: 30rpx;
			width: 500rpx;
			margin: auto;

			.score {
				border-radius: 20rpx;
				padding: 30rpx;
				color: #fff;
				font-size: 42rpx;
				background: #ff7444;
				margin-bottom: 40rpx;
			}

			.total-time {
				border-radius: 20rpx;
				padding: 30rpx;
				color: #fff;
				font-size: 42rpx;
				background: #47d1af;
			}
		}
	}

	.cover{
		img{
			    width: 80px;
			    height: 80px;
			    border-radius: 50%;
		}
		
	}
	.text-ellipsis{
		font-size: 30rpx;
	}
	.paper-section {
		padding: 60rpx;

		.data-block {
			font-size: 27rpx;

			view {
				padding: 6rpx 0;
			}
		}
	}
</style>